﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CCWin;
using System.Text.RegularExpressions;

namespace SCCM
{
    public partial class O3InputWindow : Skin_Mac
    {
        private DataItem myDataItem;
        public O3InputWindow(DataItem item)
        {
            InitializeComponent();
            this.myDataItem = item;
        }

        private void OKButton_Click(object sender, EventArgs e)
        {
            string input = O3InputTextBox.Text;
            if (Regex.IsMatch(input, @"^[0-9]+([.]{1}[0-9]+){0,1}$"))//如果是数值
            {
                myDataItem.O3 = Convert.ToDouble(input);
                this.Close();
            }
            else {
                MessageBox.Show("请输入一个数值");
            }
        }

        private void O3InputWindow_Load(object sender, EventArgs e)
        {
            O3InputTextBox.Text = myDataItem.O3.ToString();
        }

        private void O3InputTextBox_SkinTxt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.OKButton_Click(OKButton, e);
            }
        }
    }
}
